<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    [v-cloak]{
      display: none;
    }
  </style>
</head>

<body>
  <div id="app">
    <input type="text" v-model="msg">
    <input type="text" v-model="obj.a">
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        msg: "hello vue",
        obj:{
          a:'111',
          b:'222'
        }
      },
      methods: {
      },
      watch: {
        msg(newVal, oldVal){
          console.log('msg变化了',newVal)
        },
        // 'obj.a'(newVal){
        //   console.log('值改变了', newVal)
        // },
        obj:{
          handler(newVal){
            console.log('值变化了', newVal)
          },
          deep: true // 深度监听
        }
      }
    })
  </script>
</body>

</html>